<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ include file="/pages/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>广东工业大学招生办后台管理</title>
<script>
	function check(){
		//提交前设置latestAnnouncement，latestReading的值为是或否
		var newhomeCheckbox = document.getElementById("newhome");
		var newhightopCheckbox = document.getElementById("newhightop");
		var homeInput = document.getElementById("home");
		var hightopInput = document.getElementById("hightop");
		if(newhomeCheckbox.checked){
			homeInput.value="1";
		}else{
			homeInput.value="0";
		}
		if(newhightopCheckbox.checked){
			hightopInput.value="1";
		}else{
			hightopInput.value="0";
		}
	
		var article = document.getElementById("file");
		var title = document.getElementById("title");
		var artName = document.getElementById("artName");
		//alert(article.value);
		if(title.value == ""){
			alert("专题标题不能为空！");
			return false;
		}
		if(artName.value == ""){
			alert("名称不能为空！");
			return false;
		}
		if(article.value == ""){
			alert("请选择专题图片！");
			return false;
		}
		return true;
	}
	
</script>
</head>

<body>
	<form action="special-admin!save.action"  method="post" enctype="multipart/form-data" name="form" onsubmit="return check()">
	  <input type="hidden" name="entity.home" id="home"/>
	  <input type="hidden" name="entity.hightop" id="hightop"/>
	<s:if test="id!=null"><input type="hidden" name="entity.id"  value="${entity.id}"/>
	<input type="hidden" name="entity.photoUrl"  value="${entity.photoUrl}"/>
	 </s:if>
	 <input type="hidden" name="entity.consult" value="${entity.consult }"/>
	<table>
		<tr>
			<td>专题标题：</td>
			<td><input type="text" name="entity.name"  value="${entity.name}" id="title" size="100px" /></td>
		</tr>
		<tr>
			<td>文章列表名称：</td>
			<td><input type="text" name="entity.artName"  value="${entity.artName}" id="artName" size="100px" /></td>
		</tr>
		<tr>
			<td></td>
			<td>
			<input type="checkbox" id="newhome" <s:if test="home==1" >  checked="checked" </s:if> />放至首页</td>
		</tr>
		<tr>
			<td></td>
			<td><input type="checkbox" id="newhightop" <s:if test="hightop==1" >  checked="checked" </s:if> />置顶</td>
		</tr>
			<s:if test="id==null">
		<tr>
			<td>专题图片：</td>
			<td><input type="file" name="picture" id="file" /></td>
			</tr>
		    </s:if>
		    <s:else>
		     <tr>
		     <td>专题图片：</td>		  
			 <td><input type="file" name="picture" /></td></tr>
			 <tr><td></td><td><img src="${ctx}/upload/${photoUrl}" width="250" height="136" /></td></tr>
			</s:else>
		<tr>
			<td></td>
			<td><input type="submit" class="button"  value="提交" /></td>
		</tr>
	</table>
	</form>
</body>
</html>
